package com.oa.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.oa.dao.LinkDao;
import com.oa.entity.User;
import com.oa.service.LinkService;

@Service("linkService")
@Transactional
public class LinkServiceImpl implements LinkService {
	//通过注解把联系人dao注入进来
	@Resource(name="linkDao")
	private LinkDao linkDao;
	// 查询所有联系人
	@Override
	public List<User> list() {
		return linkDao.findAllEntity();
	}

	// 添加联系人
	@Override
	public boolean addLink(User user) {
		
		return linkDao.saveEntity(user);
	}

	// 修改联系人
	@Override
	public boolean updateLink(User user) {
		return linkDao.updateEntity(user);
	}

	// 删除联系人
	@Override
	public boolean deleteLink(User user) {
		return linkDao.deleteEntity(user);
	}
   //根据ID查询
	@Override
	public User getById(String unique_id) {
		return linkDao.getEntity(unique_id);
	}

}
